<template>
  <footer>
    <ul>
      <!-- <li
        v-for="item in footerList"
        :key="item.icon"
        :class="{ active: active === item.title }"
        @click="tabChange(item)"
      >
        <span class="iconfont" :class="item.icon"></span>
        <p>{{ item.title }}</p>
      </li> -->
      <router-link
        v-for="item in footerList"
        :key="item.icon"
        :to="item.url"
        tag="li"
      >
        <span class="iconfont" :class="item.icon"></span>
        <p>{{ item.title }}</p>
      </router-link>
    </ul>
  </footer>
</template>

<script>
export default {
  data() {
    return {
      // active: sessionStorage.getItem("active") || "电影/影院",
      // active: "电影/影院",
      footerList: [
        {
          title: "电影/影院",
          icon: "icon-dianying",
          url: "/home/movies",
        },
        {
          title: "视频",
          icon: "icon-shipin",
          url: "/home/video",
        },
        {
          title: "小视频",
          icon: "icon-shipin1",
          url: "/home/mini",
        },
        {
          title: "演出",
          icon: "icon-yanchu-xianxing2-0",
          url: "/home/show",
        },
        {
          title: "我的",
          icon: "icon-wode",
          url: "/home/mine",
        },
      ],
    };
  },
  // methods: {
  //   tabChange(item) {
  //     // 做高亮
  //     this.active = item.title;
  //     // sessionStorage.setItem("active", this.active);
  //     // 做跳转
  //     this.$router.push(item.url);
  //   },
  // },
  // watch: {
  // $route(to) {
  //   // console.log(to.path);
  //   this.footerList.forEach((item) => {
  //     if (item.url === to.path) {
  //       this.active = item.title;
  //     }
  //   });
  // },
  //   $route: {
  //     handler(to) {
  //       this.footerList.forEach((item) => {
  //         if (item.url === to.path) {
  //           this.active = item.title;
  //         }
  //       });
  //     },
  //     // 进页面先监听一次
  //     immediate: true,
  //   },
  // },
};
</script>

<style lang="less" scoped>
@import "../../../assets/css/var.less";
footer {
  position: fixed;
  width: 100%;
  height: 50px;
  background: #fff;
  border-top: 1px solid @border-color;
  left: 0;
  bottom: 0;
  font-size: @xs-font;

  ul {
    width: 100%;
    height: 100%;
    display: flex;

    li {
      flex: 1;
      .center();
      flex-direction: column;

      .iconfont {
        font-size: @xl-font;
      }
    }

    .router-link-active {
      color: @theme-color;
    }
  }
}
</style>
